package com.zjj.lbw.ai.old.rag;

import org.springframework.ai.embedding.EmbeddingClient;
import org.springframework.ai.vectorstore.RedisVectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class BeanConfiguration {
//    @Bean
//    public SimpleVectorStore vectorStore(EmbeddingClient embeddingClient) {
//        return new SimpleVectorStore(embeddingClient);
//    }

    @Bean
    public RedisVectorStore vectorStore(EmbeddingClient embeddingClient) {
        RedisVectorStore.RedisVectorStoreConfig config = RedisVectorStore.RedisVectorStoreConfig.builder()
                .withURI("redis://localhost:6379")
                .withMetadataFields(
                        RedisVectorStore.MetadataField.text("filename"),
                        RedisVectorStore.MetadataField.text("question"))
                .build();

        return new RedisVectorStore(config, embeddingClient);
    }
}
